<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="../common/jspcommon.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>我的存钱罐 - 果果街</title>
<%@ include file="../common/css.jsp"%>
<%@ include file="../common/js.jsp"%>
<link type="text/css" rel="stylesheet" href="/css/v4/detail.css"/>
<!--[if ie 6]><script src="/js/v3/iepng.js" type="text/javascript"></script><![endif]-->
<!--[if ie]><link href="/css/v4/common/IE.css" type="text/css" rel="stylesheet"><![endif]-->
<script type="text/javascript">
$(function(){
	//加载分页
	$.fn.pager = function(options){
		if(parseInt(options.pagecount)<=1){
			return;
		}
		$(this).html("<ul></ul>");
		if(parseInt(options.pagecount)>10){
			//如果当前页码小于5
			if(parseInt(options.pagenumber)<4){
				if(parseInt(options.pagenumber) != 1){
					$(this).find("ul").append("<li>上一页</li>");
				}
				for(var i=1; i<=5; i++){
					if(i==parseInt(options.pagenumber)){
						$(this).find("ul").append("<li class='current'><a href='#'>"+i+"</a></li>");
					}else{
						$(this).find("ul").append("<li>"+i+"</li>");
					}
				}
				$(this).find("ul").append("<li><span>...</span></li><li>"+parseInt(options.pagecount)+"</li>");
				$(this).find("ul").append("<li>下一页</li>");
			}else if((parseInt(options.pagecount)-parseInt(options.pagenumber))<3){
				//如果是倒数几页
				var temp = parseInt(options.pagecount)-4;
				if(temp==parseInt(options.pagenumber)){
					temp -= 2;
				}
				$(this).find("ul").append("<li>上一页</li>");
				$(this).find("ul").append("<li>1</li><li><span>...</span></li>");
				for(var i=temp; i<=parseInt(options.pagecount); i++){
					if(i==parseInt(options.pagenumber)){
						$(this).find("ul").append("<li class='current'><a href='#'>"+i+"</a></li>");
					}else{
						$(this).find("ul").append("<li>"+i+"</li>");
					}
				}
				if(parseInt(options.pagenumber) != parseInt(options.pagecount)){
					$(this).find("ul").append("<li>下一页</li>");
				}
			}else{
				//如果是中间几页
				$(this).find("ul").append("<li>上一页</li>");
				$(this).find("ul").append("<li>1</li>");
				//前面特殊值
				if(parseInt(options.pagenumber)!=4){
					$(this).find("ul").append("<li><span>...</span></li>");
				}
				for(var i=(parseInt(options.pagenumber)-2); i<=(parseInt(options.pagenumber)+2); i++){
					if(i==parseInt(options.pagenumber)){
						$(this).find("ul").append("<li class='current'><a href='#'>"+i+"</a></li>");
					}else{
						$(this).find("ul").append("<li>"+i+"</li>");
					}
				}
				//后面特殊值
				if((parseInt(options.pagecount)-parseInt(options.pagenumber))!=3){
					$(this).find("ul").append("<li><span>...</span></li>");
				}
				$(this).find("ul").append("<li>"+parseInt(options.pagecount)+"</li>");
				$(this).find("ul").append("<li>下一页</li>");
			}
		}else{
			if(parseInt(options.pagenumber) != 1){
				$(this).find("ul").append("<li>上一页</li>");
			}
			//如果当前页码小于10
			for(var i=1; i<=parseInt(options.pagecount); i++){
				if(i==parseInt(options.pagenumber)){
					$(this).find("ul").append("<li class='current'><a href='#'>"+i+"</a></li>");
				}else{
					$(this).find("ul").append("<li>"+i+"</li>");
				}
			}
			if(parseInt(options.pagenumber) != parseInt(options.pagecount)){
				$(this).find("ul").append("<li>下一页</li>");
			}
		}
		//给页码绑定事件
		$(this).find("ul").find("li").click(function(){
			var page = $(this).text();
			if(page == "上一页"){
				page = parseInt(options.pagenumber)-1;
			}else if(page == "下一页"){
				page = parseInt(options.pagenumber)+1;
			}
			if(page!=parseInt(options.pagenumber) && page!="..."){
				options.buttonClickCallback(page);
			}
		});
		//计算样式
		$(this).find("ul").find("li").attr("style","cursor: pointer;");
		var parWidth = $(this).parent().width();
        var tWidth = $(this).width();
        var padWidth = (parWidth - tWidth)/2 + "px";
        //$(this).css("padding-left",padWidth).css("padding-right",padWidth);
	}
	
	$("#accountDetail").load("/account/accountdetail.htm?memberId=${member.identifier}");
	$("#purchaseList").load("/account/purchaselist.htm?memberId=${member.identifier}&page=1");
	$("#accountLogList").load("/account/accountloglist.htm?memberId=${member.identifier}&page=1");
});
</script>
</head>

<body>
	<%@include file="../common/header.jsp" %>
    <!-- home_menu-->
    <%@include file="../member/menu.jsp" %>
    <!-- home_menu--end-->
        
    <!-- body -->
    
    <div class="w100p pt20 pb35">
    	<div class="w980 mg clearfix">
			<!-- home-left -->
			<div class="home_left_s2">
		   		<div class="box_s11">
		       		<div class="cqg_pd_s1">
						<div id="accountDetail">
						</div>
						<div id="purchaseList">
						</div>
						<div id="accountLogList">
						</div>
		      		</div>
		      
		      		<div class="shadow"></div>
		      	</div>
		
		  	</div>
          	<!-- meinfo -->
          	<%@include file="../member/meInfo.jsp" %>
        </div>
    </div>
    
    <%@include file="../common/footer.jsp" %>
    <!-- body--end-->
</body>
</html>